package com.sunmnet.current.aqs.threadlocal;

import javax.servlet.http.HttpServletRequest;

import com.sunmnet.current.model.SysUser;

public class SessionHolder {
   
	 private static final ThreadLocal<SysUser> userHolder = new ThreadLocal<SysUser>();

	    private static final ThreadLocal<HttpServletRequest> requestHolder = new ThreadLocal<HttpServletRequest>();

	    public static void add(SysUser sysUser) {
	        userHolder.set(sysUser);
	    }

	    public static void add(HttpServletRequest request) {
	        requestHolder.set(request);
	    }

	    public static SysUser getCurrentUser() {
	        return userHolder.get();
	    }

	    public static HttpServletRequest getCurrentRequest() {
	        return requestHolder.get();
	    }

	    public static void remove() {
	        userHolder.remove();
	        requestHolder.remove();
	    }
	
}
